import numpy as np

x = np.arange(6).reshape(3,2)
print(x)

# 1.按行迭代
for it in np.nditer(x):
    print(it, end=',')
print()

# 2.按列迭代 -- 方法1
for it in np.nditer(x, order='F'):
    print(it, end=',')
print()

# 2.按列迭代 -- 方法2
y = x.T.copy()
for it in np.nditer(y):
    print(it, end=',')
print()